package org.dtrd.modules.dict.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.dict.entity.bean.DistrictInfoDTO;

import java.util.Date;


/**
 * <p>
 * 
 * </p>
 *
 * @author QR
 * @since 2021-12-06
 */
@Data
@TableName("dtrd_ent_rd_dic_district")
public class DtrdEntRdDicDistrict {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 地区名字
     */
    @TableField("district_info_di_name")
    private String districtInfoDiName;

    @TableField("district_info_di_id")
    private Integer districtInfoDiId;

    @TableField("district_info_parent_id")
    private Integer districtInfoParentId;

    /**
     * 地区id
     */
    @TableField("district_info_area_id")
    private Integer districtInfoAreaId;

    /**
     * 省
     */
    @TableField("district_info_province_sn")
    private Integer districtInfoProvinceSn;

    /**
     * 市
     */
    @TableField("district_info_city_sn")
    private Integer districtInfoCitySn;

    @TableField("district_info_create_time")
    private Date districtInfoCreateTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntRdDicDistrict init() {
        districtInfoCreateTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntRdDicDistrict parseFromDto(DistrictInfoDTO dto) {
        dataId = dto.getDataId();
        districtInfoDiName = dto.getDistrictInfoDiName();
        districtInfoDiId = dto.getDistrictInfoDiId();
        districtInfoParentId = dto.getDistrictInfoParentId();
        districtInfoAreaId = dto.getDistrictInfoAreaId();
        districtInfoProvinceSn = dto.getDistrictInfoProvinceSn();
        districtInfoCitySn = dto.getDistrictInfoCitySn();
        districtInfoCreateTime = dto.getDistrictInfoCreateTime();
        return this;
    }

}
